#include <mem.h>
#include "Map.h"
#include "nodefabric.h"

NodeFabric g_node_fabric;

Map::Map(row r, col c) : m_row(r), m_col(c)
{
    m_node = new Node**[m_row];
    for (row i = 0; i < m_row; ++i)
    {
        m_node[i] = new Node*[m_col];
        //memset(m_node[i], addr, m_col*sizeof(Node*));
        for (col j = 0; j < m_col; ++j)
            m_node[i][j] = g_node_fabric.MakeNode('?');
    }
}

Map::~Map()
{
    for (row i = 0; i < m_row; ++i)
    {
        delete [] m_node[i];
    }

    delete [] m_node;
}

void Map::OnDiscovered(row r, col c, char character)
{
    m_node[r][c] = g_node_fabric.MakeNode(character);
}
